<?php
/*
	插件配置界面文件 (无配置则不需要此文件)
*/
?>
<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<div class="row">
	<div class="col-lg-12">
		<div class="card">
			<div class="card-header"> 
				<div class="d-flex justify-content-between">
					<h4 class="mb-0">插件配置</h4>
					<div class="btn-group">
						<a class="btn btn-outline-secondary btn-sm" href="javascript:location.reload();" role="button"><i class="icon-refresh"></i></a>
						<a class="btn btn-outline-secondary btn-sm" href="<?php echo url("plugin");?>" role="button"><i class="icon-times"></i></a>
					</div>
				</div>
			</div>
			<div class="card-body"> 
				<form action="?plugin-setting-di_blogs.htm" method="post" id="form">
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">导航设置</label>
						<div class="col-sm-10">
						<?php echo form_textarea('nav', $blogs['old_nav']);   ?>
						</div>
					</div>						
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">首页推荐</label>
						<div class="col-sm-10">
						<?php echo form_textarea('index_top', $blogs['index_top']);   ?>
						</div>
					</div>					
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">最新图片帖id</label>
						<div class="col-sm-10">
						<?php echo form_text('newImgId', $blogs['newImgId']);   ?>
						</div>
					</div>					
					<div class="form-group row">
						<label class="col-sm-2 form-control-label">推荐图片帖id</label>
						<div class="col-sm-10">
						<?php echo form_text('topImgId', $blogs['topImgId']);   ?>
						</div>
					</div>
					<div class="form-group row">
						<label class="col-sm-2 form-control-label"></label>
						<div class="col-sm-10">
							<button type="submit" class="btn btn-primary btn-block" id="submit" data-loading-text="正在提交...">确定</button>
						</div>
					</div>
				</form>

			</div>
		</div>
	</div>
</div>


<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>
<script>

$("#testbtn").click(function(){
  	email=$("#test").val();
    $.post("",{email:email,type:"test"},function(result){
        alert(result);
    });
});

let jform = $("#form");
let jsubmit = $("#submit");
let referer = '';
jform.on('submit', function(){
	jform.reset();
	jsubmit.button('loading');
	let postdata = jform.serialize();
	$.xpost(jform.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			$.alert(message);
			jsubmit.text(message).delay(2000).button('reset').location(referer);
			return;
		} else {
			$.alert(message);
			jsubmit.button('reset');
		}
	});
	return false;
});
</script>